package com.power.algorithm;

/**
 * @description:
 * @author: jiangnan
 * @time: 2021/6/18 10:13 上午
 */
public class Solution7 {
    public int reverse(int x) {
        if (x > Integer.MAX_VALUE || x < Integer.MIN_VALUE) {
            return 0;
        }
        int result = 0;
        while (x != 0) {
            int res = x % 10;
            result = result * 10 + res;
            x = x / 10;
        }
        System.out.println(result);
        return result;
    }

    public static void main(String[] args) {
        Solution7 solution7 = new Solution7();
        solution7.reverse(-23789);
    }
}
